import 'package:flutter/material.dart';
import 'package:sleep_manager/ui/about/about_page.dart';
import 'package:sleep_manager/ui/devices/my_devices_page.dart';
import 'package:sleep_manager/ui/family/add_family_page.dart';
import 'package:sleep_manager/ui/family/my_family.dart';
import 'package:sleep_manager/ui/monitor_setting/monitor_setting_page.dart';
import 'package:sleep_manager/ui/system_setting/system_setting_page.dart';

class NavigationUtils {

  // 设置页面的跳转
  void navigateToPage(BuildContext context, String pageName, {VoidCallback? onRefresh}) {
    switch (pageName) {
      case 'Family': // 我的家人
        Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => const MyFamilyPage()));
        break;
      case 'Devices':
        Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => const MyDevicesPage()));
        break;
      case 'MonitorSetting':
        Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => const MonitorSettingPage()));
        break;
      case 'SystemSetting':
        Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => const SystemSettingPage()));
        break;
      case 'About':
        Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => const AboutPage()));
        break;
      case 'AddFamily': // 添加家人
        Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => AddFamilyPage(title: '添加家人', onRefresh: onRefresh)));
        break;
      default:
        break;
    }
  }

}
